import time
def consumer(name):
    print("{NAME} 准备吃包子了".format(NAME=name))
    while True:
        baozi= yield
        print("{BAOZI}熟了,被{NAME}吃了".format(BAOZI=baozi,NAME=name))

def producer():
    c1=consumer("姚振")
    c2=consumer("何毅")
    c1.__next__()
    c2.__next__()
    print("开始蒸包子")
    for i in range(10):
        time.sleep(1)
        print("蒸好了第{i}笼包子,两个".format(i=i+1))
        c1.send("第{i}笼包子".format(i=i+1))  # send传递参数给yeild的返回值,即baozi
        c2.send("第{i}笼包子".format(i=i+1))
producer()